package com.tdy.spring_boot.modules.test.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tdy.spring_boot.modules.common.vo.entity.AbstractEntity;


import javax.persistence.*;
import java.util.List;

/**
 * @Description Clazz
 * @Author JiangHu
 * @Date 2022/8/19 13:37
 */
@Entity
@Table(name = "test_clazz")
public class Clazz extends AbstractEntity {
	private String clazzName;
	@ManyToMany(cascade = CascadeType.ALL)
	@JoinTable(name="test_clzz_student",
			joinColumns=@JoinColumn(name="clazz_id"),
			inverseJoinColumns=@JoinColumn(name="student_id")
	)
	private List<Student> students;
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@JoinColumn(name = "school_id", insertable = false, updatable = false)
	@JsonIgnore
	private School school;

	public String getClazzName() {
		return clazzName;
	}

	public void setClazzName(String clazzName) {
		this.clazzName = clazzName;
	}

	public List<Student> getStudents() {
		return students;
	}

	public void setStudents(List<Student> students) {
		this.students = students;
	}

	public School getSchool() {
		return school;
	}

	public void setSchool(School school) {
		this.school = school;
	}
}
